﻿//+-------------------------------------------------------------------------------------------------------------------------------------------------------
//
//Description:  OsVhdTagViewModel
//Author: Aravind Ramarathinam (aravr@microsoft.com)
//Copyright © Microsoft Corporation
//Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. 
//You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 
//
//THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, 
//INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. 
//See the Apache Version 2.0 License for specific language governing permissions and limitations under the License.
// 
//--------------------------------------------------------------------------------------------------------------------------------------------------------

using System.Windows.Input;
using VmroleAuthor.Commands;


namespace VmroleAuthor.ViewModels
{   
    public class OsVhdTagViewModel : ViewModelBase
    {
        private readonly IContainOsVhdTags osVhdTagsContainer;
        private string tag;


        public OsVhdTagViewModel(string tag, IContainOsVhdTags osVhdTagsContainer)
        {
            this.tag = tag;
            this.osVhdTagsContainer = osVhdTagsContainer;
            this.RemoveOsVhdTagCommand = new RelayCommand(
                param => this.RemoveTag((string)param),
                param => this.CanRemoveTag((string)param));
        }

        public string Tag
        {
            get { return this.tag; }
            set
            {
                this.tag = value;
                this.OnPropertyChanged("Tag");
            }
        }

        public ICommand RemoveOsVhdTagCommand
        {
            get;
            private set;
        }

        public bool CanRemoveTag(string toRemove)
        {
            return true;
            //return this.osVhdTagsContainer.CanRemoveTag(toRemove);
        }

        public void RemoveTag(string toRemove)
        {
            this.osVhdTagsContainer.RemoveTag(toRemove);
        }

    }
}
